package com.chb.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.chb.dao.WarehouseMapper;
import com.chb.entity.Warehouse;
import com.chb.service.WarehouseService;

@Service
@Transactional
public class WarehouseServiceImpl implements WarehouseService{
	//注入dao
	@Autowired
	private WarehouseMapper warehouseMapper;
	//实现查询仓库信息列表
	@Override
	public List<Warehouse> selectAllWarehouses(){
		return this.warehouseMapper.selectAllWarehouses();
	}
	//根据id查询
	@Override
	public Warehouse selectWarehouse(Integer id) {
		Warehouse warehouse = this.warehouseMapper.selectWarehouse(id);
		return warehouse;
	}
	//根据货物名称查询
	@Override
	public List<Warehouse> selectWarehouses(String cargoname) {
		List<Warehouse> warehouse = this.warehouseMapper.selectWarehouses(cargoname);
		return warehouse;
	}
	//修改
	@Override
	public boolean updateWarehouse(Warehouse warehouse) {
		boolean result = this.warehouseMapper.updateWarehouse(warehouse);
		return result;
	}
	//删除
	@Override
	public boolean deleteWarehouse(Warehouse warehouse) {
		boolean result = this.warehouseMapper.deleteWarehouse(warehouse);
		return result;
	}
	//出库操作
	@Override
	public boolean updateWarehouses(Warehouse warehouse) {
		boolean result = this.warehouseMapper.updateWarehouses(warehouse);
		return result;
		}
}
